package com.lee.filter;

import javax.servlet.*;
import javax.servlet.http.HttpServletRequest;
import java.io.IOException;

public class MyFilter implements Filter {

    @Override
    public void init(FilterConfig filterConfig) throws ServletException {

    }

    @Override
    public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException {
        HttpServletRequest req=(HttpServletRequest)request;
        String uri=req.getRequestURI(); //uri就是获取到的连接地址!
        if(uri.contains("index")){
            System.out.println("匹配规则");
        }else{
            System.out.println("未匹配");
        }

    }

    @Override
    public void destroy() {

    }
}
